﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; 
using CourseArraging.Frm.xygl;
using Stone.DataContracts;

namespace CourseArraging.Frm.jxgl
{
    /// <summary>
    /// 版权所有
    /// 石世特@温州医学院 sst330381@gmail.com
    /// </summary> 
    public partial class FrmWXyinfo : FrmToolbarBase
    {
        private XyService.XyServiceClient xydao = new XyService.XyServiceClient();
        private XyEntity entity;
        public delegate void refreshlist();
        public event refreshlist reflist;

        public FrmWXyinfo(int xy_id)
        {
            this.ImeMode = System.Windows.Forms.ImeMode.OnHalf;
            InitializeComponent();
            this.showData(xy_id);
        }
        
        private void showData(int xy_id)
        {
            entity = this.xydao.GetEntity(xy_id);
            this.label_xyxm.Text = entity.qdxy_stu_name;
            this.label_xylxr.Text = entity.qdxy_stu_lxr;
            this.label_xydh.Text = entity.qdxy_stu_lxdh;
            this.label_xyfx.Text = entity.qdxy_stu_dep;
            this.label_xydz.Text = entity.qdxy_stu_address;
            this.label_jyxm.Text = entity.qdxy_tec_name;
            this.label_jynj.Text = entity.qdxy_tec_grade;
            this.label_jyzy.Text = entity.qdxy_tec_course;
            this.label_jydq.Text = entity.qdxy_tec_dep;
            this.label_jydh.Text = entity.qdxy_tec_lxdh;
            this.txt_bz.Text = entity.qdxy_bz;
            this.txt_sjqk.Text = entity.qdxy_sjqk;
        }

        private void btn_xydadj_Click(object sender, EventArgs e)
        {
            FrmStuInfo frm = new FrmStuInfo();
            frm.ShowDialog();
        }

        public override void tsb_save_fun()
        {
            entity.qdxy_sjqk = txt_sjqk.Text.Trim();
            entity.qdxy_bz = txt_bz.Text.Trim();
            entity.qdxy_zt = comboBox1.Text;
            xydao.Update(entity);
            reflist();
        }
        public override bool be4save()
        {
            if (string.IsNullOrEmpty(comboBox1.Text))
            {
                MessageBox.Show("请选择授课状态 !", "保存失败");
            }
            return true;
        }
    }
}
